<template>
  <el-dialog :show-close=false
             :close-on-press-escape=false
             :close-on-click-modal=false
             width="600px"
             :title="isNew?$getTextByLangKey('新增'):$getTextByLangKey('编辑')"
             :visible.sync="dialogVisible"
             @keyup.enter.native="confrimDialog">

    <el-row style="margin-bottom: 30px">

      <el-col :span="22">
        <div class="item">
          <span class="label">{{$getTextByLangKey('名称')+'：'}}</span>
          <el-input v-model="formData.name"></el-input>
        </div>
      </el-col>

      <el-col :span="22">
        <div class="item">
          <span class="label">{{$getTextByLangKey('设备类型')+'：'}}</span>
          <el-select :placeholder="$getTextByLangKey('请选择设备类型')" v-model ="formData.machineType">
            <el-option
              v-for="item in machineTypeList"
              :key="item.type"
              :label="item.name"
              :value="item.type"
            >
            </el-option>
          </el-select>
        </div>
      </el-col>

      <el-col :span="22">
        <div class="item">
          <span class="label">{{$getTextByLangKey('产线')+'：'}}</span>
          <el-input v-model="formData.lineName"></el-input>
        </div>
      </el-col>

      <el-col :span="22">
        <div class="item">
          <span class="label">{{$getTextByLangKey('IP')+'：'}}</span>
          <el-input v-model="formData.ip"></el-input>
        </div>
      </el-col>
      <el-col :span="22">
        <div class="item">
          <span class="label">{{$getTextByLangKey('扫描器编码')+'：'}}</span>
          <el-input v-model="formData.mac"></el-input>
        </div>
      </el-col>
      <el-col :span="22">
        <div class="item">
          <span class="label">{{$getTextByLangKey('备注说明')+'：'}}</span>
          <el-input v-model="formData.note"></el-input>
        </div>
      </el-col>

    </el-row>


    <span slot="footer" class="dialog-footer">
        <el-button @click="cancelDialog">{{$getTextByLangKey('取消')}}</el-button>
        <el-button type="primary"
                   @click="confrimDialog"

        >{{$getTextByLangKey('确定')}}</el-button>
      </span>
  </el-dialog>
</template>
<script>

  // import Request from '@/common/js/Request'
  import util from '@/common/js/util'

  export default {
    name: "search-action-componet",
    props: ['dialogVisible','formData','rowIndex','isNew','machineTypeList'],
    data() {
      return {
      }
    },
    created: function () {

    },
    methods: {
      cancelDialog: function () {
        this.$emit('cancelDialog')
      },
      confrimDialog: function () {
        this.$emit('confrimDialog', this.formData,this.rowIndex)
      }
    }
  }

</script>

<style >

  /*.div-search-action {*/
    /*line-height: 50px;*/

  /*}*/

  /deep/ label.el-form-item__label{
    width: 150px !important;
  }

  /deep/  .el-form-item__content{
    margin-left: 150px !important;
  }

  /deep/ .first-el-select{
    padding-left: 10px;
  }
  /deep/  .el-button-delete-data{
    margin-left: 10px;
  }
  .el-dialog__body {
    padding-top: 10px;
    padding-bottom: 0px;
  }

  .el-dialog__footer {
    padding-top: 0px;
  }

  .el-form-left {
    margin-right: 10px;
  }

  .el-form-right {
    margin-left: 10px;
  }
</style>

<style scoped>
  .item{
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    width: 100%;

  }

  .item .el-select{
    flex: 1;
  }

  .label{
    width: 120px;
    flex-shrink: 0;
    text-align: right;
  }

</style>
